<?php

require_once 'UC_DBClass.php';

$pdh = new PDO('mysql:host=127.0.0.1;dbname=db1', 'root');
$server = new UC_DBServer($pdh);

/*foreach($server->get_Databases() as $database)
{
    echo $database->get_Name() . '<br />';
    
    foreach($database->get_Tables() as $table)
    {
        echo "________ " . $table->get_Name() . '<br />';
        foreach($table->get_Columns() as $column)
        {
            echo "________________ " . $column->get_Name() . '<br />';
        }
    }
}


$db = new UC_Database();
$db->set_Name('SomeDatabase');
echo '<pre>' . $db->ScriptCreate() . '</pre>';
echo '<pre>' . $db->ScriptAlter() . '</pre>';

*/

//UC_DBClass::CreateFromTable_($server, 'db1', 'test1');

class UC_DBClass_db1_test1 extends UC_DBClass 
{
    
    public function get_a ()
    {
        return $this->a;
    }
    
    public function get_b ()
    {
        return $this->b;
    }
    
    public function get_c ()
    {
        return $this->c;
    }
    
    public function set_c ($c)
    {
        $this->c = $c;
        $this->set_Touched_(true);
    }
    
    public function get_d ()
    {
        return $this->d;
    }
    
    public function set_d ($d)
    {
        $this->d = $d;
        $this->set_Touched_(true);
    }
    
    public function __construct (UC_DBServer $Server, $a, $b)
    {
        $this->select_statement = "Select * From db1.test1 Where a = '$a' And b = '$b'";
        parent::__construct($Server);
        $this->a = $this->table_row['a'];
        $this->b = $this->table_row['b'];
        $this->c = $this->table_row['c'];
        $this->d = $this->table_row['d'];
    }
    
    public function Put_ ()
    {
        $this->update_statement = "UPDATE db1.test1 SET c = '{$this->get_c()}', d = '{$this->get_d()}' WHERE a = '{$this->get_a()}'  AND b = '{$this->get_b()}' ";
        parent::Put_();
    }
    
    public function Delete_ ()
    {
        $this->delete_statement = "DELETE FROM db1.test1 WHERE a = '{$this->get_a()}'  AND b = '{$this->get_b()}' ";
        parent::Delete_();
    }
    
    private $a;
    
    private $b;
    
    private $c;
    
    private $d;
}

$i = new UC_DBClass_db1_test1($server, 1, 1);
$i->Delete_();

?>
